<?php

namespace IDock\Insurance\ZFIC\Request;

use IDock\Insurance\ZFIC\Response\CommonResponse;
use IDock\Insurance\ZFIC\Response\VehicleModelResponse;
use IDock\Visitor\VehicleModelVisitor;

class CarModelQueryRequest extends AllZFICRequest
{

    protected $urlTip = '车型查询';
    protected $route = '/car/api/carmodels';
    protected $response = VehicleModelResponse::class;

    /**
     * @var VehicleModelVisitor $visitor
     */
    protected $visitor;

    public $totalCount = 0;

    public function generate(): array
    {
        $modelName = preg_replace('/[\x{4e00}-\x{9fa5}]+(-[\x{4e00}-\x{9fa5}])?/u','',$this->visitor->vehicleModel);
        $param = [
            "vehicleName" => $this->visitor->vehicleModel,
            "searchCode" => '',
            "vehiclePriceBegin" => '',
            "vehiclePriceEnd" => '',
            "vehicleBrand" => '',
            "vehicleClass" => '',
            "vehicleSeries" => '',
            "vehicleMaker" => '',
            "modelCode" => '',
            "vehicleId" => '',//$this->visitor->vin
            "pageNo" => '0',
            "pageSize" => $this->totalCount ?: 10,
            "singeinDate" => $this->visitor->firstRegisterDate,
        ];
        foreach ($param as $key => $val) {
            if ($val === '') {
                unset($param[$key]);
            }
        }
        return $param;
    }

    public function getStaffConfig(&$chalCode, &$userCode){
        $chalCode = $this->visitor->argc['chalCode'] ?? '';
        $userCode = $this->visitor->argc['userCode'] ?? '';
    }


}